﻿
using System;
using System.Collections.Generic;
using System.Data;
namespace AssettDatabase.BLL
{
    class Asset_Type
    {
        public bool Add(string Asset_Type_Name)
        {
            DAL.Asset_Type mAsset_Type = new DAL.Asset_Type();
            return mAsset_Type.Add(Asset_Type_Name);
        }

        public bool Update(string Asset_Type_Name, string Asset_Type_ID)
        {
            DAL.Asset_Type mAsset_Type = new DAL.Asset_Type();
            return mAsset_Type.Update(Asset_Type_Name, Asset_Type_ID);
        }

        public List<VO.Asset_Type> GetAsset_Type()
        {
            List<VO.Asset_Type> mList = new List<VO.Asset_Type>();
            DAL.Asset_Type mAsset_Type = new DAL.Asset_Type();
            DataTable mDataTable = mAsset_Type.GetAsset_Type();

            foreach (DataRow dr in mDataTable.Rows)
            {
                VO.Asset_Type voAsset_Type = new VO.Asset_Type();
                voAsset_Type.Asset_Type_ID = Convert.ToInt32(dr["Asset_Type_ID"].ToString());
                voAsset_Type.Asset_Type_Name = dr["Asset_Type_Name"].ToString();

                mList.Add(voAsset_Type);
            }

            return mList;
        }
    }
}
